<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<%@ page import="java.io.*;" %>
<%
int attachment_id=Integer.parseInt(request.getParameter("attachment_id"));

String filename=request.getParameter("filename");
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition",
"attachment;filename="+filename);
File file = new File("C:/Users/SIVA KRISHNA/workspace/CampusMetalink/WebContent/attachments/"+attachment_id+"/"+filename);
FileInputStream fileIn = new FileInputStream(file);
ServletOutputStream output = response.getOutputStream();
 
byte[] outputByte = new byte[4096];
//copy binary contect to output stream
while(fileIn.read(outputByte, 0, 4096) != -1)
{
	output.write(outputByte, 0, 4096);
}
fileIn.close();
output.flush();
output.close();




%>
</body>
</html>